home *** CD-ROM | disk | FTP | other *** search
- Path: news.umbc.edu!not-for-mail
- From: schlein@umbc.edu (Jonas J. Schlein)
- Newsgroups: comp.lang.c
- Subject: Re: A question on for loop
- Date: 18 Mar 1996 14:19:54 -0500
- Organization: University of Maryland Baltimore County
- Message-ID: <4ikd0q$3c0@umbc9.umbc.edu>
- References: <31471574.79D9@hdc-usa.com> <4i77ca$161@ccshst05.cs.uoguelph.ca>
- NNTP-Posting-Host: umbc9.umbc.edu
- NNTP-Posting-User: schlein
-
- |> My novice's answer is yes, i starts off at 0 because the for statement
- |> (i=0;i<20;i++) has i++ meaning that i is incremented after the
- |> operation. If it were (i=0;i<20;++i) then i would start at 1 and run up
- |> to 20. Is this correct?
- |> Toby Hay thay@uoguelph.ca
-
- No you are 100% wrong...Both of the for() loops you have there are identical
- except for the fact one had i++ and the other ++i. If you wanted it to
- start at 1 and run to 20 then write it as (i = 1; i < 20; i++).
- --
- "If it wasn't for C, we would be using BASI, PASAL, and OBOL."
-
- Jonas J. Schlein (schlein@gl.umbc.edu)
-